﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;

using My.ELibrary.Model.News;
using My.ELibrary.Business.News;

public partial class News_NewsList : System.Web.UI.Page
{
    private string m_Type = "1";
    private string NewsType
    {
        get
        {
            if (Request.QueryString["NewsType"] != null && Request.QueryString["NewsType"].ToString() != string.Empty)
            {
                m_Type = Request.QueryString["NewsType"].ToString();
            }
            return m_Type;
        }
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            this.lblType.Text = GetTypeName();
            
            List<ElibNewsModel> elibList = new List<ElibNewsModel>();
            elibList = ElibNewsBLL.GetInstance().GetOneTypeOfNews(int.Parse(NewsType));
            this.DataList1.DataSource = elibList;
            this.DataList1.DataBind();
    
        }
    }

    private string GetTypeName()
    {
        string TypeTitle = string.Empty;
        switch (NewsType)
        {
            case "1":
                TypeTitle = "文化新闻";
                break;
            case "2":
                TypeTitle = "图书新闻";
                break;
            case "3":
                TypeTitle = "政策法规";
                break;
            case "4":
                TypeTitle = "出版社新闻";
                break;
            default :
                TypeTitle = "文化新闻";
                break;
        }
        return TypeTitle;
    }
}
